import java.util.ArrayList;

/*
 * Created by Jesse Phillips
 * Created on 12-Jan-06
 */

public class Circle extends TwoDShape {
	protected double radius;

	public Circle(double radius) {
		super("Circle");
		this.radius = radius;
	}

	@Override
	public double area() {
		return Math.PI*radius*radius;
	}

	@Override
	public double perimeter() {
		return 2*Math.PI*radius;
	}
	
	public static Circle create(double radius) throws ShapeException {
		if(TwoDShape.validate(radius))
			return new Circle(radius);
		else {
			ArrayList<Double> foo = new ArrayList<Double>();
			foo.add(radius);
			throw new ShapeException("Circle", "Radius cannot be zero.", foo);
		}
	}
	
	public String toString() {
		return super.toString()+"\nRadius: "+radius;
	}

}
